<?
	$default_date = strtotime("+2 week");

	// Set holiday search criteria
	if(isset($_COOKIE['holiday_search_string'])){               
		$array_holiday_search_string = explode("~", $_COOKIE['holiday_search_string']);
                $holiday_search_form_values['destination_tree_master_id'] = $array_holiday_search_string[1];                
		$holiday_search_form_values['destination_tree_id'] = $array_holiday_search_string[2];                
		$holiday_search_form_values['departure_airport'] = $array_holiday_search_string[3];
		$holiday_search_form_values['date_day'] = $array_holiday_search_string[4];
		$holiday_search_form_values['date_month'] = $array_holiday_search_string[5];
		$holiday_search_form_values['give_take'] = $array_holiday_search_string[6];
		$holiday_search_form_values['nights'] = $array_holiday_search_string[7];
		$holiday_search_form_values['pax_adult'] = $array_holiday_search_string[8];
		$holiday_search_form_values['pax_child'] = $array_holiday_search_string[9];              

	}else{
		$holiday_search_form_values = array(
			"destination_tree_id"=>"",
			"departure_airport"=>"",
			"date_day"=>date('j',$default_date),
			"date_month"=>date('m-Y',$default_date),
			"give_take"=>"3",
			"nights"=>"7",
			"pax_adult"=>"2",
			"pax_child"=>"0"	
		);
	}
        		
	// Set hotel search criteria        
    $hotel_search_form_values['destination_tree_id'] = $_SESSION['hotels_search_params']['data']['destination_tree_id'];   
    $hotel_search_form_values['destination_tree_master_id'] = $_SESSION['hotels_search_params']['data']['destination_tree_master_id'];
    
    if($_SESSION['hotels_search_params']['data']['date_day']){
		$hotel_search_form_values['date_day'] = $_SESSION['hotels_search_params']['data']['date_day'];
	}else{
		$hotel_search_form_values['date_day'] = date('j',$default_date);
	}
    if($_SESSION['hotels_search_params']['data']['date_month']){
		$hotel_search_form_values['date_month'] = $_SESSION['hotels_search_params']['data']['date_month'];
	}else{
		$hotel_search_form_values['date_month'] = date('m-Y',$default_date);
	}
    if($_SESSION['hotels_search_params']['data']['nights']){
		$hotel_search_form_values['nights'] = $_SESSION['hotels_search_params']['data']['nights'];
	}else{
		$hotel_search_form_values['nights'] = '7';
	}
    $hotel_search_form_values['no_rooms'] = $_SESSION['hotels_search_params']['data']['no_rooms'];
    $hotel_search_form_values['room_adults_1'] = $_SESSION['hotels_search_params']['data']['room_adults_1'];
    $hotel_search_form_values['room_children_1'] = $_SESSION['hotels_search_params']['data']['room_children_1'];
    $hotel_search_form_values['room_adults_2'] = $_SESSION['hotels_search_params']['data']['room_adults_2'];
    $hotel_search_form_values['room_children_2'] = $_SESSION['hotels_search_params']['data']['room_children_2'];      
    $hotel_search_form_values['room_adults_3'] = $_SESSION['hotels_search_params']['data']['room_adults_3'];
    $hotel_search_form_values['room_children_3'] = $_SESSION['hotels_search_params']['data']['room_children_3'];   
    $hotel_search_form_values['room_children_1_age_1'] = $_SESSION['hotels_search_params']['data']['room_children_1_age_1'];
    $hotel_search_form_values['room_children_1_age_2'] = $_SESSION['hotels_search_params']['data']['room_children_1_age_2'];
    $hotel_search_form_values['room_children_1_age_3'] = $_SESSION['hotels_search_params']['data']['room_children_1_age_3'];
    $hotel_search_form_values['room_children_1_age_4'] = $_SESSION['hotels_search_params']['data']['room_children_1_age_4'];
    $hotel_search_form_values['room_children_2_age_1'] = $_SESSION['hotels_search_params']['data']['room_children_2_age_1'];
    $hotel_search_form_values['room_children_2_age_2'] = $_SESSION['hotels_search_params']['data']['room_children_2_age_2'];
    $hotel_search_form_values['room_children_2_age_3'] = $_SESSION['hotels_search_params']['data']['room_children_2_age_3'];
    $hotel_search_form_values['room_children_2_age_4'] = $_SESSION['hotels_search_params']['data']['room_children_2_age_4'];
    $hotel_search_form_values['room_children_3_age_1'] = $_SESSION['hotels_search_params']['data']['room_children_3_age_1'];
    $hotel_search_form_values['room_children_3_age_2'] = $_SESSION['hotels_search_params']['data']['room_children_3_age_2'];
    $hotel_search_form_values['room_children_3_age_3'] = $_SESSION['hotels_search_params']['data']['room_children_3_age_3'];
    $hotel_search_form_values['room_children_3_age_4'] = $_SESSION['hotels_search_params']['data']['room_children_3_age_4'];  
        
	// Main tab
	if($_COOKIE['main_tab']){
		if($_COOKIE['main_tab']=='holidays'){
			$tab_holidays_class = "search_tab_holidays_on";
			$tab_hotels_class = "search_tab_hotels_off";
			$search_hotels_form_hide_class = "hideme";
		}
		if($_COOKIE['main_tab']=='hotels'){
			$tab_holidays_class = "search_tab_holidays_off";
			$tab_hotels_class = "search_tab_hotels_on";
			$search_holidays_form_hide_class = "hideme";
		}
	}else{
		$tab_holidays_class = "search_tab_holidays_off";
		$tab_hotels_class = "search_tab_hotels_on";
		$search_hotels_form_hide_class = "hideme";
	}

?>



<!-- Start left col -->

<div class="col_180 margin_right_10">





<div class="box_search box_margin">
<div class="box_search_shoe">
<div class="box_search_cap">


<div class="box_search_tabs">


	<ul>
		<li id="search_tab_holidays" class="<?= $tab_holidays_class ?>" title="Last minute holidays"><div class="search_tab_holidays_div"><input name="search_type" id="search_type_holidays" value="holidays" type="radio" class="search_tab_radio" <?= checked($_COOKIE['main_tab'],'holidays') ?> /><label class="search_tab_label" for="search_type_holidays">Holidays</label></div></li>
		<li id="search_tab_hotels" class="<?= $tab_hotels_class ?>" title="cheap hotels"><div class="search_tab_hotels_div"><input name="search_type" id="search_type_hotels" value="hotels" type="radio" class="search_tab_radio" <?= checked($_COOKIE['main_tab'],'hotels') ?> /><label class="search_tab_label" for="search_type_hotels">Hotels</label></div></li>
	</ul>

</div>




<div class="box_padding_search">










<!-- Start Package holiday form -->

<div id="form_package" class="<?= $search_holidays_form_hide_class ?>">

<form action="/holidays/results_group.html" method="post" title="Holidays">


<input type="hidden" name="holiday_search" value="search" />


      
<div class="search_form_row">

<div class="search_form_label_row">
<div class="search_label"><label class="search_form_label" for="destination_tree_id_holiday">Destination</label></div>
</div>
<? 
$destination_menu_class = "search_form_select_long";
require SITE_ROOT_PATH."/_lib/html/html_destination_menu_holidays.php";
?>
</div>



<!--      
<div class="search_form_row">

<div class="search_form_label_row">
<div class="search_label"><label class="search_form_label" for="destination_tree_id_holiday">Destination 2</label></div>
</div>
<? 
//$destination_menu_class = "search_form_select_long";
//require SITE_ROOT_PATH."/_lib/html/html_destination_child_menu_holidays.php";
?>
</div>

-->



<div class="search_form_row">

<div class="search_form_label_row">
<div class="search_label"><label class="search_form_label" for="departure_airport">Departure airport</label></div>
</div>

<? 
$departure_menu_class = "search_form_select_long";
require SITE_ROOT_PATH."/_lib/html/html_departure_menu.php";
?>

</div>


      
      
      

	


<? 


// Get the dates you want to display 
$input_dates = date_output(); 

?> 

	
<div class="search_form_row">

<div class="search_form_label_row">
<div class="search_label">
  <label class="search_form_label" for="holidays-date-day">Departure date</label>
</div>
</div>

<div class="search_form_day_col">
<select name="date_day" id="holidays-date-day" class="search_form_select_day">
<?
	foreach($input_dates['days'] as $day){
?>
<option value='<?= $day['value'] ?>' <?= selected($day['value'],$holiday_search_form_values['date_day']) ?> ><?= $day['description'] ?></option>
<?
	}

?>
</select>
</div>

<div class="search_form_month_col">
<select name="date_month" id="holidays-date-month" class="search_form_select_month">
<?
	foreach($input_dates['months_year'] as $month_year){
?>
<option value='<?= $month_year['value'] ?>'  <?= selected($month_year['value'],$holiday_search_form_values['date_month']) ?>  ><?= $month_year['description'] ?></option>

<?
	}

?>
</select>
</div>


<div class="search_form_datepicker_col">
<input id="datepicker-holidays" type="hidden" />
</div>


<div class="clearing"></div>
</div>

	  





<div class="search_form_row">

<div class="search_form_label_row">
<div class="search_label"><label class="search_form_label" for="give_take">Give or take</label></div>
</div>
	
<select name="give_take" id="give_take" <?= $search_form_fields_class ?>>
  <option value="1" <?= selected($holiday_search_form_values['give_take'],'1') ?>>1 day</option>
  <option value="2" <?= selected($holiday_search_form_values['give_take'],'2') ?>>2 days</option>
  <option value="3" <?= selected($holiday_search_form_values['give_take'],'3') ?>>3 days</option>
  <option value="4" <?= selected($holiday_search_form_values['give_take'],'4') ?>>4 days</option>
  <option value="5" <?= selected($holiday_search_form_values['give_take'],'5') ?>>5 days</option>
</select>
    
</div>






<div class="search_form_row">

<div class="search_form_label_row">
<div class="search_label"><label class="search_form_label" for="nights_holidays">Nights</label></div>
</div>
	<select name="nights" id="nights_holidays" <?= $search_form_fields_class ?>>
	  <option value="">Any</option>
      <option value="4" <?= selected($holiday_search_form_values['nights'],'4') ?>>3 - 5 nights</option>
      <option value="7" <?= selected($holiday_search_form_values['nights'],'7') ?> >6 - 8 nights</option>
      <option value="11" <?= selected($holiday_search_form_values['nights'],'11') ?>>9 - 12 nights</option>
      <option value="14" <?= selected($holiday_search_form_values['nights'],'14') ?>>13+ nights</option>
    </select>

</div>







<div class="search_form_row">

<div class="search_form_label_row">
<div class="search_label"><label class="search_form_label" for="pax_adult">No. of passengers</label></div>
</div>

	
    <span class="adult_small_text">Adult</span><select name="pax_adult" id="pax_adult" class="search_form_select_short">
    <option value="2" <?= selected($holiday_search_form_values['pax_adult'],'2') ?>>2</option>      
    <option value="3" <?= selected($holiday_search_form_values['pax_adult'],'3') ?>>3</option>
    <option value="4" <?= selected($holiday_search_form_values['pax_adult'],'4') ?>>4</option>
    <option value="5" <?= selected($holiday_search_form_values['pax_adult'],'5') ?>>5</option>
    <option value="6" <?= selected($holiday_search_form_values['pax_adult'],'6') ?>>6</option>
    <option value="7" <?= selected($holiday_search_form_values['pax_adult'],'7') ?>>7</option>
    <option value="8" <?= selected($holiday_search_form_values['pax_adult'],'8') ?>>8</option>
    </select><span class="adult_small_text">Child</span><select name="pax_child" id="pax_child" class="search_form_select_short">
    <option value="0" <?= selected($holiday_search_form_values['pax_child'],'0') ?>>0</option> 
    <option value="1" <?= selected($holiday_search_form_values['pax_child'],'1') ?>>1</option>   
    <option value="2" <?= selected($holiday_search_form_values['pax_child'],'2') ?>>2</option>  
    <option value="3" <?= selected($holiday_search_form_values['pax_child'],'3') ?>>3</option>
    <option value="4" <?= selected($holiday_search_form_values['pax_child'],'4') ?>>4</option>
    <option value="5" <?= selected($holiday_search_form_values['pax_child'],'5') ?>>5</option>
    <option value="6" <?= selected($holiday_search_form_values['pax_child'],'6') ?>>6</option>
    </select>
    
</div>
	

<div class="search_form_button_row">
<input type="image" src="/images/button_search.gif" value="submit" class="search_form_button" alt="Search" />
</div>

</form>

</div>

<!-- End Package holiday form -->























<!-- Start hotel search form -->

<div id="form_hotel" class="<?= $search_hotels_form_hide_class ?>">

<form method="post" action="/hotels/hotel_results.php" >

<input type="hidden" name="search_hotels" value="true" />


<div class="search_form_row">

<div class="search_form_label_row">
<div class="search_label"><label class="search_form_label" for="destination_tree_id_hotels">Destination</label></div>
</div>
<? 
$destination_menu_class = "search_form_select_long";
require SITE_ROOT_PATH."/_lib/html/html_destination_menu_hotels.php";
?>
</div>


<div class="search_form_row">
<div class="search_form_label_row">
<div class="search_label"><label class="search_form_label" for="destination_tree_id">Resorts </label></div>
</div>
<? 
$resort_menu_class = "search_form_select_long";
require SITE_ROOT_PATH."/_lib/html/html_destination_menu_resorts.php";
?>
</div>


<!--

<div class="search_form_row">

<div class="search_form_label_row">
<div class="search_label"><label class="search_form_label" for="resort_tree_id">Resort</label></div>
</div>
<select name="resort_tree_id" id="resort_tree_id" class="search_form_select_long">
	<option value="53">San Antonio</option>
</select>

</div>

-->




<? 


// Get the dates you want to display 
$input_dates = date_output(); 

?> 


<div class="search_form_row">

<div class="search_form_label_row">
<div class="search_label">
  <label class="search_form_label" for="hotels-date-day">Check-in date</label>
</div>
</div>

<div class="search_form_day_col">
<select name="date_day" id="hotels-date-day" class="search_form_select_day">
<?
	foreach($input_dates['days'] as $day){
?>
<option value='<?= $day['value'] ?>' <?= selected($day['value'], $hotel_search_form_values['date_day']) ?> ><?= $day['description'] ?></option>
<?
	}

?>
</select>
</div>

<div class="search_form_month_col">
<select name="date_month" id="hotels-date-month" class="search_form_select_month">
<?
	foreach($input_dates['months_year'] as $month_year){
?>
<option value='<?= $month_year['value'] ?>'  <?= selected($month_year['value'],$hotel_search_form_values['date_month']) ?>  ><?= $month_year['description'] ?></option>
<?
	}

?>
</select>
</div>

<div class="search_form_datepicker_col">
<input id="datepicker-hotels" type="hidden" />
</div>


<div class="clearing"></div>
</div>








<div class="search_form_row">

<div class="search_form_label_row">
<div class="search_label"><label class="search_form_label" for="nights_hotels">Nights</label></div>

</div>
    
	<select name="nights" id="nights_hotels" class="search_form_select_med">
      <option value="1" <?= selected($hotel_search_form_values['nights'],'1') ?>>1</option>
      <option value="2" <?= selected($hotel_search_form_values['nights'],'2') ?>>2</option>            
      <option value="3" <?= selected($hotel_search_form_values['nights'],'3') ?>>3</option>
      <option value="4" <?= selected($hotel_search_form_values['nights'],'4') ?>>4</option>
      <option value="5" <?= selected($hotel_search_form_values['nights'],'5') ?>>5</option>
	  <option value="6" <?= selected($hotel_search_form_values['nights'],'6') ?>>6</option>
      <option value="7" <?= selected($hotel_search_form_values['nights'],'7') ?>>7</option>
      <option value="8" <?= selected($hotel_search_form_values['nights'],'8') ?>>8</option>
      <option value="9" <?= selected($hotel_search_form_values['nights'],'9') ?>>9</option>
      <option value="10" <?= selected($hotel_search_form_values['nights'],'10') ?>>10</option>
      <option value="11" <?= selected($hotel_search_form_values['nights'],'11') ?>>11</option>
      <option value="12" <?= selected($hotel_search_form_values['nights'],'12') ?>>12</option>
      <option value="13" <?= selected($hotel_search_form_values['nights'],'13') ?>>13</option>
      <option value="14" <?= selected($hotel_search_form_values['nights'],'14') ?>>14</option>
    </select>

</div>













<div class="search_form_row no_margin">

<div class="search_form_label_row">
<div class="search_label">
  <label class="search_form_label" for="no_rooms">No. rooms</label>
</div>
</div>

    <select name="no_rooms" id="no_rooms" class="search_form_select_med">
        <option value="1" <?= selected($hotel_search_form_values['no_rooms'],'1') ?>>1</option>
        <option value="2" <?= selected($hotel_search_form_values['no_rooms'],'2') ?>>2</option>
        <option value="3" <?= selected($hotel_search_form_values['no_rooms'],'3') ?>>3</option>
    </select>

</div>


<div class="search_form_label_row">
<div class="search_label_small search_form_room_col">&nbsp;</div>
<div class="search_label_small search_form_room_adult_col">Adults</div>
<div class="search_label_small search_form_room_child_col">Children</div>
</div>



<!-- Start room 1 -->
<div id="room-1" class="search_form_row_room">

<div class="search_form_room_label search_form_room_col">Room 1</div>

<div class="search_form_room_adult_col">
<select name="room_adults_1" class="search_form_select_short">
    <option value="1" <?= selected($hotel_search_form_values['room_adults_1'],'1') ?>>1</option>
    <option value="2" <?= selected($hotel_search_form_values['room_adults_1'],'2') ?>>2</option>
    <option value="3" <?= selected($hotel_search_form_values['room_adults_1'],'3') ?>>3</option>
    <option value="4" <?= selected($hotel_search_form_values['room_adults_1'],'4') ?>>4</option>
</select>
</div>

<div class="search_form_room_child_col">
<select name="room_children_1" class="search_form_select_short" id="room_children_1">
    <option value="0" <?= selected($hotel_search_form_values['room_children_1'],'0') ?>>0</option>
    <option value="1" <?= selected($hotel_search_form_values['room_children_1'],'1') ?>>1</option>
    <option value="2" <?= selected($hotel_search_form_values['room_children_1'],'2') ?>>2</option>
    <option value="3" <?= selected($hotel_search_form_values['room_children_1'],'3') ?>>3</option>
    <option value="4" <?= selected($hotel_search_form_values['room_children_1'],'4') ?>>4</option>
</select>
</div>

<?php



function output_child_age_row($id){


    $children = 4;
    $max_age = 17;
    
  for ($index = 1; $index <= $children; $index++): 
       $selectName = 'room_children_'.$id.'_age_'. $index;
 ?>
       <div id="<?=$selectName ?>_div" class="search_form_room_child_age_row">
           <label>Child Age <?= $index; ?></label>
            <div class="search_form_room_child_age_col">
                <select name="<?=$selectName ?>" class="search_form_select_short">
                    <?php for ($i = 0; $i <=$max_age; $i++): ?> 
                            <option value="<?=$i?>" <?= selected($hotel_search_form_values[$selectName],$i) ?>> <?=$i?> </option>    
                    <? endfor ?>
                </select>
            </div>
        </div>       
<? 

        endfor; 

}
    
    
    output_child_age_row(1);
    
?>

<div class="clearing"></div>

</div>
<!-- End room 1 -->



<!-- Start room 2 -->
<div id="room-2" class="search_form_row_room">

<div class="search_form_room_label search_form_room_col">Room 2</div>

<div class="search_form_room_adult_col">
<select name="room_adults_2" class="search_form_select_short">
    <option value="1" <?= selected($hotel_search_form_values['room_adults_2'],'1') ?>>1</option>
    <option value="2" <?= selected($hotel_search_form_values['room_adults_2'],'2') ?>>2</option>
    <option value="3" <?= selected($hotel_search_form_values['room_adults_2'],'3') ?>>3</option>
    <option value="4" <?= selected($hotel_search_form_values['room_adults_2'],'4') ?>>4</option>
</select>
</div>

<div class="search_form_room_child_col">
<select name="room_children_2" class="search_form_select_short" id="room_children_2">
    <option value="0" <?= selected($hotel_search_form_values['room_children_2'],'0') ?>>0</option>
    <option value="1" <?= selected($hotel_search_form_values['room_children_2'],'1') ?>>1</option>
    <option value="2" <?= selected($hotel_search_form_values['room_children_2'],'2') ?>>2</option>
    <option value="3" <?= selected($hotel_search_form_values['room_children_2'],'3') ?>>3</option>
    <option value="4" <?= selected($hotel_search_form_values['room_children_2'],'4') ?>>4</option>
</select>
</div>





<?php
// ID = 2
    output_child_age_row(2);
?>

<div class="clearing"></div>

</div>
<!-- End room 2 -->

<!-- Start room 3 -->
<div id="room-3" class="search_form_row_room">

<div class="search_form_room_label search_form_room_col">Room 3</div>

<div class="search_form_room_adult_col">
<select name="room_adults_3" class="search_form_select_short">
	<option value="1" <?= selected($hotel_search_form_values['room_adults_3'],'1') ?>>1</option>
    <option value="2" <?= selected($hotel_search_form_values['room_adults_3'],'2') ?>>2</option>
    <option value="3" <?= selected($hotel_search_form_values['room_adults_3'],'3') ?>>3</option>
    <option value="4" <?= selected($hotel_search_form_values['room_adults_3'],'4') ?>>4</option>
</select>
</div>

<div class="search_form_room_child_col">
<select name="room_children_3" class="search_form_select_short" id="room_children_3">
    <option value="0" <?= selected($hotel_search_form_values['room_children_3'],'0') ?>>0</option>
	<option value="1" <?= selected($hotel_search_form_values['room_children_3'],'1') ?>>1</option>
    <option value="2" <?= selected($hotel_search_form_values['room_children_3'],'2') ?>>2</option>
    <option value="3" <?= selected($hotel_search_form_values['room_children_3'],'3') ?>>3</option>
    <option value="4" <?= selected($hotel_search_form_values['room_children_3'],'4') ?>>4</option>
</select>
</div>

<?php
// ID = 3
    output_child_age_row(3);
?>

<div class="clearing"></div>

</div>
<!-- End room 3 -->




<div class="search_form_button_row">
<input type="image" src="/images/button_search.gif" value="submit" class="search_form_button" alt="Search" />
</div>


</form>

</div>

<!-- End hotel search form -->
















</div>



</div>
</div>
</div>







<!-- Start newsletter signup -->

<div class="box_or_180_cap box_margin">
<div class="box_or_180_shoe">
<div class="box_padding">

<h3 class="h3_white_plain">Get The Best Deals</h3>

	<form action="/newsletter.html" method="post" class="newsletter_form" name="newsletter_form">
	
	<input type="hidden" name="action" value="validate"/>
	
	<p class="white margin_bottom_5">Get our best <strong>Late Deals</strong> sent straight to your inbox.</p>
	
	<table class="newsletter_table">
	<tr>
	<td><input type="text" name="epost" class="text_newsletter_signup" value="Your email address" onblur="if(!this.value) this.value='Your email address';" onfocus="if(this.value) this.value='';" /></td>
	<td><div style="margin-left: 10px; text-align: center"><input type="image" src="/images/button_go_blue.gif" value="submit" alt="Submit" /></div></td>
	</tr></table>
		
	
	</form>
</div>
</div>
</div>

<!-- End newsletter signup -->








<!-- Start banner box -->

<? include SITE_ROOT_PATH."/_lib/html/banners/banner_left_col.php" ?>

<!-- End banner box -->











</div>
<!-- End left column -->





<?php

flush();

?>